Skip to content

Conversation

@vip-amzn
Copy link
Collaborator

@vip-amzn vip-amzn commented Nov 4, 2025

Issue #, if available:
closes #93
Changes:

  1. step_with_retry.py:
    With counter-based deterministic behavior:

    • Attempt 1: counter = 1 < 2 → raises RuntimeError ❌
    • Attempt 2: counter = 2 >= 2 → succeeds ✓
  2. steps_with_retry.py:
    With counter-based deterministic behavior:

    • Poll 1, Attempt 1: counter = 1 → raises RuntimeError ❌
    • Poll 1, Attempt 2: counter = 2 → returns None
    • Poll 2, Attempt 1: counter = 3 → returns item ✓

Dependencies

If this PR requires testing against a specific branch of the Python Language SDK (e.g., for unreleased changes), uncomment and specify the branch below. Otherwise, leave commented to use the main branch.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@vip-amzn vip-amzn changed the title fix: make retry examples deterministic using seeded random fix: make retry examples using seeded random Nov 4, 2025
@vip-amzn vip-amzn closed this Nov 4, 2025
@vip-amzn vip-amzn reopened this Nov 4, 2025
rarepolz
rarepolz previously approved these changes Nov 4, 2025
yaythomas
yaythomas previously approved these changes Nov 5, 2025
@vip-amzn vip-amzn force-pushed the fix_flaky_tests branch 7 times, most recently from 81648e3 to ba83c86 Compare November 5, 2025 11:09
@vip-amzn vip-amzn requested a review from yaythomas November 5, 2025 15:51
ghost
ghost previously requested changes Nov 6, 2025
@vip-amzn vip-amzn requested a review from yaythomas November 10, 2025 18:15
@wangyb-A
Copy link
Contributor

Is it possible to pass the random seed through lambda invoke event? So that we can have same random seed in both lambda function and the pytest function. It keeps the randomness and make it easier to assert on the random result.

@vip-amzn vip-amzn requested a review from bchampp as a code owner November 11, 2025 10:42
@vip-amzn vip-amzn requested a review from a user November 11, 2025 10:46
@vip-amzn vip-amzn requested a review from rarepolz November 11, 2025 10:46
bchampp
bchampp previously approved these changes Nov 11, 2025
@yaythomas yaythomas dismissed ghost ’s stale review November 12, 2025 17:30

stale

@yaythomas yaythomas merged commit a3cda91 into main Nov 12, 2025
32 checks passed
@yaythomas yaythomas deleted the fix_flaky_tests branch November 12, 2025 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix intermittent test failures in test_steps_with_retry

5 participants